home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Harvest C 1.3 / Source Code / SRC.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-16  |  2.7 KB  |  83 lines  |  [TEXT/ALFA]

  1. /*
  2.  * Harvest C
  3.  * 
  4.  * Copyright 1991 Eric W. Sink   All rights reserved.
  5.  * 
  6.  * This file defines the interface for SRC records.
  7.  * 
  8.  */
  9.  
  10. #ifndef SRC_INTERFACE
  11. #define SRC_INTERFACE
  12.  
  13. typedef struct SRCListS         SRCList_t;
  14. typedef SRCList_t P__H         *SRCListVia_t;
  15. typedef struct SRCS             SRCKind_t;
  16. typedef SRCKind_t P__H         *SRCKindVia_t;
  17.  
  18. #include "SymTable.h"
  19. #include "PPSymTable.h"
  20.  
  21. /* ------------------ SRC -------------------- */
  22. /*
  23.  * Below, are the data structure definitions for SRC.  A SRC is the location
  24.  * of the C code that we are processing. In other words, this tells the IO
  25.  * routines where to get the C source code.  The alternatives are a file or a
  26.  * string. The RawCharacter routine knows enough to make the current SRC
  27.  * transparent to the rest of the compiler.  This allows other routines the
  28.  * ability to change the SRC of the program code easily. For example,
  29.  * #include changes the SRC to another file, pushing the current file onto
  30.  * the SRC stack.  When some SRC ends, the stack is popped.  When the stack
  31.  * is empty, parsing terminates.
  32.  */
  33.  
  34. union SRC {
  35.     FILE *                io;
  36.     EString_t                       mem;
  37. };
  38.  
  39. #define SRC_SYSHEADER 1
  40. #define SRC_USRHEADER 2
  41. #define SRC_USRFILE   3
  42.  
  43. struct SRCS {
  44.     int                             isIO;
  45.     int                                fileKind;
  46.     union SRC                       where;
  47.     char                            ExtraChar[MAXEXTRA];
  48.     int                             NumExtras;
  49.     int                             LineCount;
  50.     long                            CharCount;
  51.     short                           PreprocLineDirty;
  52.     int                             eol;
  53.     PPSYMVia_t                      Macro;
  54.     EString_t                       NeedtoKill;
  55.     int                             memindex;
  56.     struct uniqstring P__H         *alreadyincluded;
  57.     char                            fname[64];
  58.     unsigned int                    CountCasts;
  59.     unsigned int                    TotalIdentifierLength;
  60.     unsigned int                    CountIdentifiers;
  61.     unsigned int                    PreprocSubsts;
  62.     unsigned int                    PreprocAfter;
  63.     unsigned int                    PreprocBefore;
  64.     unsigned int                    CountPreprocCondits;
  65.     unsigned int                    StmtCount;
  66.     unsigned int                    CountComments;
  67.     unsigned int                    CommentBytes;
  68. };
  69.  
  70. /*
  71.  * the ExtraChar field above, gives the parser the ability to put back
  72.  * characters if it decides it has read too many.  The RawCharacter routine
  73.  * checks this buffer before returning a new one read from the current SRC.
  74.  * Handy...
  75.  */
  76.  
  77. struct SRCListS {
  78.     SRCKindVia_t                    data;
  79.     struct SRCListS P__H           *next;
  80. };
  81.  
  82. #endif
  83.